package A03_稀疏数组和队列.A32_队列;

import java.util.Scanner;

/**
 * @Author: KingWang
 * @Date: 2021/6/1
 * @Desc:
 **/
public class QueueDemo {

    public static void main(String[] args) {
        Queue q = new Queue(3);
//        for (int i = 0; i <3 ; i++) {
//            q.add(UUID.randomUUID().toString().substring(0,10));
//        }
//        q.show();

        Scanner scanner = new Scanner(System.in);
        boolean quit = false;
        while(!quit){

            System.out.println("1-添加，2-输出，3-查询，0-退出");
            String numStr = scanner.next();
            int num = -1;
            try{
                num = Integer.valueOf(numStr);
            }catch (Exception e){
//                e.printStackTrace();
//                System.out.println("输入不是数字0-3，请重新输入：");
            }
            switch (num){
                case 0:
                    quit = true;
                    break;
                case 1:
                    System.out.println("请输入待添加的字符串：");
                    String str = scanner.next();
                    q.add(str);
                    break;
                case 2:
                    System.out.println(q.pop());
                    break;
                case 3:
                    q.show();
                    break;
                default:
                    System.out.println("无此选项,请重新输入：");
                    break;
            }

        }


    }


}
